Component({
  data: {
    selected: 0,
    color: '#cdcdcd',
    selectedColor: '#d81e06',
    list: [
      {
        pagePath: '/pages/index/index',
        text: '首页',
        iconPath: '../icon/unchecked/yinle.png',
        selectedIconPath: '../icon/checked/yinle.png',
      },
      {
        pagePath: '/pages/plaza/index',
        text: '音乐广场',
        iconPath: '../icon/unchecked/yinleguangchang.png',
        selectedIconPath: '../icon/checked/yinleguangchang.png',
      },
      {
        iconPath: '../icon/searchicon/vynil.png',
        bulge: true,
      },
      {
        pagePath: '/pages/service/index',
        text: '在线客服',
        iconPath: '../icon/unchecked/zaixiankefu.png',
        selectedIconPath: '../icon/checked/zaixiankefu.png',
      },
      {
        pagePath: '/pages/myhome/index',
        text: '我的',
        iconPath: '../icon/unchecked/wode.png',
        selectedIconPath: '../icon/checked/wode.png',
      },
    ],
  },
  attached() {},
  methods: {
    switchTab(e) {
      const { bulge } = e.currentTarget.dataset
      if (bulge) {
        wx.navigateTo({ url: '/pages/public/index' })
      } else {
        //获取到自定义数据
        const data = e.currentTarget.dataset
        //自定义跳转路径
        const url = data.path
        //跳转
        wx.switchTab({ url })
        //获取自定义下标
        this.setData({
          selected: data.index,
        })
      }
    },
  },
})
